package org.selenium.in;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

public class SearchPage {
	private WebDriver driver;

	public SearchPage(WebDriver driver) {
		this.driver=driver;
	}

	 String searchTitle() {
		return driver.findElement(By.id("allresults_info")).getText();
	}
		
	
	public boolean validateBooksLinkIsPresent() {
		return driver.findElement(By.linkText("Books Home")).isDisplayed();
	}

	public void clickOnSearchResults(String toBeClicked) {
		// TODO Auto-generated method stub
		driver.findElement(By.partialLinkText(toBeClicked)).click();		
	}

	public void clickOnAddToCart() throws Exception {
		// TODO Auto-generated method stub
		driver.findElement(By.id("mprod-buy-btn")).click();
		Thread.sleep(2000);
		//driver.findElement(By.xpath("//div[@class='window alpha30 window-absolute']/span[@class='close-icon close header-close-icon']")).click();	
	}

}